home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_perl.idb / usr / freeware / catman / p_man / cat3 / autouse.Z / autouse
Encoding:
Text File  |  1998-10-28  |  3.3 KB  |  133 lines

  1.  
  2.  
  3.  
  4.      aaaauuuuttttoooouuuusssseeee((((3333))))         22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))        aaaauuuuttttoooouuuusssseeee((((3333))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.       autouse - postpone load of modules until a function is used
  10.  
  11.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.         use    autouse    'Carp' => qw(carp croak);
  13.         carp "this carp was    predeclared and    autoused ";
  14.  
  15.  
  16.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  17.       If the module    Module is already loaded, then the declaration
  18.  
  19.         use    autouse    'Module' => qw(func1 func2($;$)    Module::func3);
  20.  
  21.       is equivalent    to
  22.  
  23.         use    Module qw(func1    func2);
  24.  
  25.       if Module defines _f_u_n_c_2() with prototype ($;$), and _f_u_n_c_1()
  26.       and _f_u_n_c_3() have no prototypes.  (At least if    Module uses
  27.       Exporter's import, otherwise it is a fatal error.)
  28.  
  29.       If the module    Module is not loaded yet, then the above
  30.       declaration declares functions _f_u_n_c_1() and _f_u_n_c_2() in    the
  31.       current package, and declares    a function _M_o_d_u_l_e::_f_u_n_c_3().
  32.       When these functions are called, they    load the package
  33.       Module if needed, and    substitute themselves with the correct
  34.       definitions.
  35.  
  36.      WWWWAAAARRRRNNNNIIIINNNNGGGG
  37.       Using    autouse    will move important steps of your program's
  38.       execution from compile time to runtime.  This    can
  39.  
  40.       +o    Break the execution of your program if the module you
  41.            autoused    has some initialization    which it expects to be
  42.            done early.
  43.  
  44.       +o    hide bugs in your code since important checks (like
  45.            correctness of prototypes) is moved from    compile    time
  46.            to runtime.  In particular, if the prototype you
  47.            specified on autouse line is wrong, you will not    find
  48.            it out until the    corresponding function is executed.
  49.            This will be very unfortunate for functions which are
  50.            not always called (note that for    such functions
  51.            autouseing gives    biggest    win, for a workaround see
  52.            below).
  53.  
  54.       To alleviate the second problem (partially) it is advised to
  55.       write    your scripts like this:
  56.  
  57.         use    Module;
  58.         use    autouse    Module => qw(carp($) croak(&$));
  59.         carp "this carp was    predeclared and    autoused ";
  60.  
  61.  
  62.  
  63.      Page 1                        (printed 10/23/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      aaaauuuuttttoooouuuusssseeee((((3333))))         22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))        aaaauuuuttttoooouuuusssseeee((((3333))))
  71.  
  72.  
  73.  
  74.       The first line ensures that the errors in your argument
  75.       specification    are found early.  When you ship    your
  76.       application you should comment out the first line, since it
  77.       makes    the second one useless.
  78.  
  79.      AAAAUUUUTTTTHHHHOOOORRRR
  80.       Ilya Zakharevich (ilya@math.ohio-state.edu)
  81.  
  82.      SSSSEEEEEEEE AAAALLLLSSSSOOOO
  83.       _p_e_r_l(1).
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.      Page 2                        (printed 10/23/98)
  130.  
  131.  
  132.  
  133.